import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";

// Retrieve the information of an object on the blockchain by object id.

async function getObject(id: string) {
  const fullNodeUrl = getFullnodeUrl("mainnet");
  const client = new SuiClient({ url: fullNodeUrl });

  const objectInfo = await client.getObject({
    id,
    options: { showDisplay: true, showType: true, showContent: true },
  });

  const content = objectInfo.data?.content;
  const display = objectInfo.data?.display;

  return { content, display };
}

const objectId =
  "0xfff7c613d39a609ff58ff460c370feb1882eccf903dedb107b08d9cec1ac1b63";
getObject(objectId).then(console.log).catch(console.error);
